﻿Imports Arwani
Imports System.Data
Imports System.Web
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Web.UI.WebControls
Imports System.IO
Imports System.Drawing


Partial Class Backend_ManageManuals
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If (Session("ADMIN_USER") IsNot Nothing) Then
            bindgrid()
        Else
            Response.Redirect("Default.aspx")

        End If

    End Sub

    Protected Sub bindgrid()
        '"WHERE (a.custcode = '" & Request.Cookies("Code").Value & "') and " & _
        Dim awrcon As New ArwaniController
        Dim str As String = "SELECT IDENTITY (int, 1, 1) AS [ID], a.Articleno, a.Serialno, a.invno as [Invoice No.],a.Manuals, b.DELDATE as [Invoice Date] into #temptry " & _
            "FROM serviceaftersale a INNER JOIN INVOICEMASTER b ON a.invno = b.INVOICENO " & _
            "WHERE" & _
            "(len(ltrim(rtrim(a.q1invno))) <> 0 or len(ltrim(rtrim(a.q2invno))) <> 0 or len(ltrim(rtrim(a.q3invno))) <> 0 or len(ltrim(rtrim(a.q4invno))) <> 0 ) " & _
            "GROUP BY a.Articleno, a.serialno, a.invno,a.Manuals, b.DELDATE order by b.deldate,a.articleno " & _
            "SELECT * FROM #Temptry ORDER BY [ID] DROP TABLE #Temptry "
        Dim dtTable As DataTable = awrcon.ExecuteQuery(str)
        If dtTable.Rows.Count > 0 Then
            gridViewMaster.DataSource = dtTable
            gridViewMaster.DataBind()

        End If
    End Sub


    
    Protected Sub nestedGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.DataRow Then

        End If
    End Sub



    Protected Function GetCheckedOutValue(checkedOut As String, invoicenumber As String) As String
        If checkedOut = "" Then
            Dim ret As String = "<a style='cursor: pointer;' onclick=" & """ basicPopup('" & invoicenumber & "');return false;" & """>Upload Manuals</a>"
            Return ret

        Else
            Dim ret As String = "<a style='cursor: pointer;' onclick=" & """ basicPopup('" & invoicenumber & "');return false;" & """>Uploaded</a><a href='../Manuals/" & checkedOut & "' target='_blank'>&nbsp;/&nbsp;view</a>"

            Return ret
        End If
    End Function


End Class
